perf(cli): optimize quality scoring and deterministic merge allocations - #640
cline-cloud[bot] merged 12 commits into
Conversation
- Pre-calculate total lines using byte scanning and early exit duplicate checking once unique line threshold is met in `score_content`. - Restrict YAML frontmatter checks to header slice and guard structural anchor searches in `score_content`. - Pre-allocate HashSet capacity (128) and use `&str` instead of `String` allocations for line deduplication in `deterministic_merge`. - Reuse static `LINK_REGEX` in `deterministic_merge` to avoid per-call regex compilation.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
- Restrict YAML frontmatter checks to header slice in score_content. - Pre-allocate HashSet capacity and use &str for line deduplication. - Reuse static LINK_REGEX in deterministic_merge to avoid per-call compile.
- Restrict YAML frontmatter checks to header slice in score_content. - Pre-allocate HashSet capacity and use &str for line deduplication. - Reuse static LINK_REGEX in deterministic_merge to avoid per-call compile.
- Restrict YAML frontmatter checks to header slice in score_content. - Pre-allocate HashSet capacity and use &str for line deduplication. - Reuse static LINK_REGEX in deterministic_merge to avoid per-call compile.
🔥 Roast: a
|
# Conflicts: # .github/workflows/yaml-lint.yml
Restores INITIAL_LINE_CAPACITY rather than inlining the literal 128, and derives the frontmatter header end from the delimiter lengths instead of the magic offset +7. Adds a regression test proving that field names appearing only in the body, after the closing delimiter, no longer earn the frontmatter bonus. Refs #640
The regression test asserted a 0.05 gap on content that already scored 1.0, where the final score.clamp(0.0, 1.0) hides the bonus entirely. Passing empty links applies the missing-links penalty, leaving headroom (real 0.95 vs spoofed 0.90). Also drops a stray blank line and a trailing blank line that cargo fmt --check rejected. Refs #640
- Restrict YAML frontmatter checks to header slice in score_content. - Pre-allocate HashSet capacity and use &str for line deduplication. - Reuse static LINK_REGEX in deterministic_merge to avoid per-call compile.
- Restrict YAML frontmatter checks to header slice in score_content. - Pre-allocate HashSet capacity and use &str for line deduplication. - Reuse static LINK_REGEX in deterministic_merge to avoid per-call compile.
cargo fmt --check failed on cli/tests/quality.rs:42. Scanned the touched Rust files and collapsed the remaining consecutive blank lines. Refs #640
What
Two CLI files, both genuine wins:
cli/src/synthesis.rs: hoists the link regex into aLazyLock.mainrecompiled
https?://...on everydeterministic_merge()call.cli/src/synthesis.rs:seen_lines.insert(trimmed)instead ofinsert(trimmed.to_string()), removing a heap allocation per content line,plus
HashSet::with_capacity.cli/src/quality.rs:has_frontmatternow inspects only the frontmatterblock, so field names appearing in the body after the closing delimiter can
no longer spoof the bonus.
cli/src/quality.rs: keepsINITIAL_LINE_CAPACITY, and derives the headerend from the delimiter lengths instead of a magic
+7.cli/tests/quality.rs: regression test proving the spoofed case no longerearns the bonus.
Rebased
The original branch also carried 11 files that had already landed on
main:nine
dtolnay/rust-toolchainSHA bumps and fourweb/app/*accessibilityedits from #639.
mainis merged in and those are dropped, so the PR is nowexactly the two CLI files plus the test.